# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

DEPLOY_CONF_NAME:raspberrypi = "Raspberry Pi"
DEPLOY_CONF_NAME:raspberrypi0 = "Raspberry Pi Zero"
DEPLOY_CONF_NAME:raspberrypi2 = "Raspberry Pi 2"
DEPLOY_CONF_NAME:raspberrypi3 = "Raspberry Pi 3"
DEPLOY_CONF_NAME:raspberrypi4 = "Raspberry Pi 4"
DEPLOY_CONF_NAME:raspberrypi4-64 = "Raspberry Pi 4 64-bit"
DEPLOY_CONF_NAME:raspberrypi5 = "Raspberry Pi 5"
DEPLOY_CONF_NAME:raspberrypi-armv8 = "Raspberry Pi Development Boards (64bit)"

IMAGE_FSTYPES += "wic.xz"

DEPLOY_CONF_IMAGE_TYPE = "wic.xz"

QBSP_IMAGE_CONTENT += "\
    ${IMAGE_LINK_NAME}.${DEPLOY_CONF_IMAGE_TYPE} \
    ${IMAGE_LINK_NAME}.conf \
    ${IMAGE_LINK_NAME}.info \
    "

MACHINE_EXTRA_INSTALL:append:arm = "\
        omxplayer \
        "

KERNEL_MODULE_AUTOLOAD += "snd-bcm2835 bcm2835-v4l2"
KERNEL_MODULE_PROBECONF += "bcm2835-v4l2"
module_conf_bcm2835-v4l2 = "options bcm2835-v4l2 gst_v4l2src_is_broken=1"

# use correct wifi firmware
CYFMAC43455_SDIO_FIRMWARE:raspberrypi-armv8 = "standard"

# video camera support
VIDEO_CAMERA = "1"

RPI_EXTRA_CONFIG = "# \
Enable the onboard ALSA audio \n\
dtparam=audio=on \n\
"

# enable device mode from usb-c
ENABLE_DWC2_PERIPHERAL = "1"

# additional memory for GPU
GPU_MEM_256 = "128"
GPU_MEM_512 = "256"
GPU_MEM_1024 = "256"

MACHINE_FEATURES += "pitft"

# hdmi output without blackbars
DISABLE_OVERSCAN = "1"

# switch to full KMS
VC4DTBO:raspberrypi-armv8 ?= "vc4-kms-v3d"

RPI_KERNEL_DEVICETREE_OVERLAYS = "\
    overlays/overlay_map.dtb \
    overlays/act-led.dtbo \
    overlays/adafruit-st7735r.dtbo \
    overlays/adafruit18.dtbo \
    overlays/adau1977-adc.dtbo \
    overlays/adau7002-simple.dtbo \
    overlays/ads1015.dtbo \
    overlays/ads1115.dtbo \
    overlays/ads7846.dtbo \
    overlays/adv7282m.dtbo \
    overlays/adv728x-m.dtbo \
    overlays/akkordion-iqdacplus.dtbo \
    overlays/allo-boss-dac-pcm512x-audio.dtbo \
    overlays/allo-boss2-dac-audio.dtbo \
    overlays/allo-digione.dtbo \
    overlays/allo-katana-dac-audio.dtbo \
    overlays/allo-piano-dac-pcm512x-audio.dtbo \
    overlays/allo-piano-dac-plus-pcm512x-audio.dtbo \
    overlays/anyspi.dtbo \
    overlays/apds9960.dtbo \
    overlays/applepi-dac.dtbo \
    overlays/arducam-64mp.dtbo \
    overlays/arducam-pivariety.dtbo \
    overlays/at86rf233.dtbo \
    overlays/audioinjector-addons.dtbo \
    overlays/audioinjector-bare-i2s.dtbo \
    overlays/audioinjector-isolated-soundcard.dtbo \
    overlays/audioinjector-ultra.dtbo \
    overlays/audioinjector-wm8731-audio.dtbo \
    overlays/audiosense-pi.dtbo \
    overlays/audremap.dtbo \
    overlays/audremap-pi5.dtbo \
    overlays/balena-fin.dtbo \
    overlays/bcm2712d0.dtbo \
    overlays/camera-mux-2port.dtbo \
    overlays/camera-mux-4port.dtbo \
    overlays/cap1106.dtbo \
    overlays/chipcap2.dtbo \
    overlays/chipdip-dac.dtbo \
    overlays/cirrus-wm5102.dtbo \
    overlays/cm-swap-i2c0.dtbo \
    overlays/cma.dtbo \
    overlays/crystalfontz-cfa050_pi_m.dtbo \
    overlays/cutiepi-panel.dtbo \
    overlays/dacberry400.dtbo \
    overlays/dht11.dtbo \
    overlays/dionaudio-kiwi.dtbo \
    overlays/dionaudio-loco.dtbo \
    overlays/dionaudio-loco-v2.dtbo \
    overlays/disable-bt.dtbo \
    overlays/disable-bt-pi5.dtbo \
    overlays/disable-emmc2.dtbo \
    overlays/disable-wifi.dtbo \
    overlays/disable-wifi-pi5.dtbo \
    overlays/dpi18.dtbo \
    overlays/dpi18cpadhi.dtbo \
    overlays/dpi24.dtbo \
    overlays/draws.dtbo \
    overlays/dwc-otg-deprecated.dtbo \
    overlays/dwc2.dtbo \
    overlays/edt-ft5406.dtbo \
    overlays/enc28j60.dtbo \
    overlays/enc28j60-spi2.dtbo \
    overlays/exc3000.dtbo \
    overlays/ezsound-6x8iso.dtbo \
    overlays/fbtft.dtbo \
    overlays/fe-pi-audio.dtbo \
    overlays/fsm-demo.dtbo \
    overlays/gc9a01.dtbo \
    overlays/ghost-amp.dtbo \
    overlays/goodix.dtbo \
    overlays/googlevoicehat-soundcard.dtbo \
    overlays/gpio-charger.dtbo \
    overlays/gpio-fan.dtbo \
    overlays/gpio-hog.dtbo \
    overlays/gpio-ir.dtbo \
    overlays/gpio-ir-tx.dtbo \
    overlays/gpio-key.dtbo \
    overlays/gpio-led.dtbo \
    overlays/gpio-no-bank0-irq.dtbo \
    overlays/gpio-no-irq.dtbo \
    overlays/gpio-poweroff.dtbo \
    overlays/gpio-shutdown.dtbo \
    overlays/hd44780-i2c-lcd.dtbo \
    overlays/hd44780-lcd.dtbo \
    overlays/hdmi-backlight-hwhack-gpio.dtbo \
    overlays/hifiberry-adc.dtbo \
    overlays/hifiberry-adc8x.dtbo \
    overlays/hifiberry-amp.dtbo \
    overlays/hifiberry-amp100.dtbo \
    overlays/hifiberry-amp3.dtbo \
    overlays/hifiberry-amp4pro.dtbo \
    overlays/hifiberry-dac.dtbo \
    overlays/hifiberry-dac8x.dtbo \
    overlays/hifiberry-dacplus.dtbo \
    overlays/hifiberry-dacplus-pro.dtbo \
    overlays/hifiberry-dacplus-std.dtbo \
    overlays/hifiberry-dacplusadc.dtbo \
    overlays/hifiberry-dacplusadcpro.dtbo \
    overlays/hifiberry-dacplusdsp.dtbo \
    overlays/hifiberry-dacplushd.dtbo \
    overlays/hifiberry-digi.dtbo \
    overlays/hifiberry-digi-pro.dtbo \
    overlays/highperi.dtbo \
    overlays/hy28a.dtbo \
    overlays/hy28b-2017.dtbo \
    overlays/hy28b.dtbo \
    overlays/i-sabre-q2m.dtbo \
    overlays/i2c-bcm2708.dtbo \
    overlays/i2c-fan.dtbo \
    overlays/i2c-gpio.dtbo \
    overlays/i2c-mux.dtbo \
    overlays/i2c-pwm-pca9685a.dtbo \
    overlays/i2c-rtc-gpio.dtbo \
    overlays/i2c-rtc.dtbo \
    overlays/i2c-sensor.dtbo \
    overlays/i2c0.dtbo \
    overlays/i2c0-pi5.dtbo \
    overlays/i2c1.dtbo \
    overlays/i2c1-pi5.dtbo \
    overlays/i2c2-pi5.dtbo \
    overlays/i2c3.dtbo \
    overlays/i2c3-pi5.dtbo \
    overlays/i2c4.dtbo \
    overlays/i2c5.dtbo \
    overlays/i2c6.dtbo \
    overlays/i2s-dac.dtbo \
    overlays/i2s-gpio28-31.dtbo \
    overlays/i2s-master-dac.dtbo \
    overlays/ilitek251x.dtbo \
    overlays/imx219.dtbo \
    overlays/imx258.dtbo \
    overlays/imx283.dtbo \
    overlays/imx290.dtbo \
    overlays/imx296.dtbo \
    overlays/imx327.dtbo \
    overlays/imx335.dtbo \
    overlays/imx378.dtbo \
    overlays/imx415.dtbo \
    overlays/imx462.dtbo \
    overlays/imx477.dtbo \
    overlays/imx500.dtbo \
    overlays/imx500-pi5.dtbo \
    overlays/imx519.dtbo \
    overlays/imx708.dtbo \
    overlays/interludeaudio-analog.dtbo \
    overlays/interludeaudio-digital.dtbo \
    overlays/iqaudio-codec.dtbo \
    overlays/iqaudio-dac.dtbo \
    overlays/iqaudio-dacplus.dtbo \
    overlays/iqaudio-digi-wm8804-audio.dtbo \
    overlays/iqs550.dtbo \
    overlays/irs1125.dtbo \
    overlays/jedec-spi-nor.dtbo \
    overlays/justboom-both.dtbo \
    overlays/justboom-dac.dtbo \
    overlays/justboom-digi.dtbo \
    overlays/ltc294x.dtbo \
    overlays/max98357a.dtbo \
    overlays/maxtherm.dtbo \
    overlays/mbed-dac.dtbo \
    overlays/mcp23017.dtbo \
    overlays/mcp23s17.dtbo \
    overlays/mcp2515-can0.dtbo \
    overlays/mcp2515-can1.dtbo \
    overlays/mcp2515.dtbo \
    overlays/mcp251xfd.dtbo \
    overlays/mcp3008.dtbo \
    overlays/mcp3202.dtbo \
    overlays/mcp342x.dtbo \
    overlays/media-center.dtbo \
    overlays/merus-amp.dtbo \
    overlays/midi-uart0.dtbo \
    overlays/midi-uart0-pi5.dtbo \
    overlays/midi-uart1.dtbo \
    overlays/midi-uart1-pi5.dtbo \
    overlays/midi-uart2.dtbo \
    overlays/midi-uart2-pi5.dtbo \
    overlays/midi-uart3.dtbo \
    overlays/midi-uart3-pi5.dtbo \
    overlays/midi-uart4.dtbo \
    overlays/midi-uart4-pi5.dtbo \
    overlays/midi-uart5.dtbo \
    overlays/minipitft13.dtbo \
    overlays/miniuart-bt.dtbo \
    overlays/mipi-dbi-spi.dtbo \
    overlays/mira220.dtbo \
    overlays/mlx90640.dtbo \
    overlays/mmc.dtbo \
    overlays/mz61581.dtbo \
    overlays/ov2311.dtbo \
    overlays/ov5647.dtbo \
    overlays/ov64a40.dtbo \
    overlays/ov7251.dtbo \
    overlays/ov9281.dtbo \
    overlays/papirus.dtbo \
    overlays/pca953x.dtbo \
    overlays/pcf857x.dtbo \
    overlays/pcie-32bit-dma.dtbo \
    overlays/pcie-32bit-dma-pi5.dtbo \
    overlays/pciex1-compat-pi5.dtbo \
    overlays/pibell.dtbo \
    overlays/pifacedigital.dtbo \
    overlays/pifi-40.dtbo \
    overlays/pifi-dac-hd.dtbo \
    overlays/pifi-dac-zero.dtbo \
    overlays/pifi-mini-210.dtbo \
    overlays/piglow.dtbo \
    overlays/pimidi.dtbo \
    overlays/pineboards-hat-ai.dtbo \
    overlays/pineboards-hatdrive-poe-plus.dtbo \
    overlays/piscreen.dtbo \
    overlays/piscreen2r.dtbo \
    overlays/pisound-micro.dtbo \
    overlays/pisound.dtbo \
    overlays/pisound-pi5.dtbo \
    overlays/pitft22.dtbo \
    overlays/pitft28-capacitive.dtbo \
    overlays/pitft28-resistive.dtbo \
    overlays/pitft35-resistive.dtbo \
    overlays/pivision.dtbo \
    overlays/pps-gpio.dtbo \
    overlays/proto-codec.dtbo \
    overlays/pwm-2chan.dtbo \
    overlays/pwm-gpio-fan.dtbo \
    overlays/pwm-gpio.dtbo \
    overlays/pwm-ir-tx.dtbo \
    overlays/pwm.dtbo \
    overlays/pwm-pio.dtbo \
    overlays/pwm1.dtbo \
    overlays/qca7000.dtbo \
    overlays/qca7000-uart0.dtbo \
    overlays/ramoops.dtbo \
    overlays/ramoops-pi4.dtbo \
    overlays/rootmaster.dtbo \
    overlays/rotary-encoder.dtbo \
    overlays/rpi-backlight.dtbo \
    overlays/rpi-codeczero.dtbo \
    overlays/rpi-dacplus.dtbo \
    overlays/rpi-dacpro.dtbo \
    overlays/rpi-digiampplus.dtbo \
    overlays/rpi-ft5406.dtbo \
    overlays/rpi-fw-uart.dtbo \
    overlays/rpi-poe.dtbo \
    overlays/rpi-poe-plus.dtbo \
    overlays/rpi-sense.dtbo \
    overlays/rpi-sense-v2.dtbo \
    overlays/rpi-tv.dtbo \
    overlays/rra-digidac1-wm8741-audio.dtbo \
    overlays/sainsmart18.dtbo \
    overlays/sc16is750-i2c.dtbo \
    overlays/sc16is752-i2c.dtbo \
    overlays/sc16is75x-spi.dtbo \
    overlays/sdhost.dtbo \
    overlays/sdio.dtbo \
    overlays/sdio-pi5.dtbo \
    overlays/seeed-can-fd-hat-v1.dtbo \
    overlays/seeed-can-fd-hat-v2.dtbo \
    overlays/sh1106-spi.dtbo \
    overlays/si446x-spi0.dtbo \
    overlays/smi-dev.dtbo \
    overlays/smi-nand.dtbo \
    overlays/smi.dtbo \
    overlays/spi-gpio35-39.dtbo \
    overlays/spi-gpio40-45.dtbo \
    overlays/spi-rtc.dtbo \
    overlays/spi0-0cs.dtbo \
    overlays/spi0-1cs-inverted.dtbo \
    overlays/spi0-1cs.dtbo \
    overlays/spi0-2cs.dtbo \
    overlays/spi1-1cs.dtbo \
    overlays/spi1-2cs.dtbo \
    overlays/spi1-3cs.dtbo \
    overlays/spi2-1cs.dtbo \
    overlays/spi2-1cs-pi5.dtbo \
    overlays/spi2-2cs.dtbo \
    overlays/spi2-2cs-pi5.dtbo \
    overlays/spi2-3cs.dtbo \
    overlays/spi3-1cs.dtbo \
    overlays/spi3-1cs-pi5.dtbo \
    overlays/spi3-2cs.dtbo \
    overlays/spi3-2cs-pi5.dtbo \
    overlays/spi4-1cs.dtbo \
    overlays/spi4-2cs.dtbo \
    overlays/spi5-1cs.dtbo \
    overlays/spi5-1cs-pi5.dtbo \
    overlays/spi5-2cs.dtbo \
    overlays/spi5-2cs-pi5.dtbo \
    overlays/spi6-1cs.dtbo \
    overlays/spi6-2cs.dtbo \
    overlays/ssd1306.dtbo \
    overlays/ssd1306-spi.dtbo \
    overlays/ssd1327-spi.dtbo \
    overlays/ssd1331-spi.dtbo \
    overlays/ssd1351-spi.dtbo \
    overlays/sunfounder-pipower3.dtbo \
    overlays/sunfounder-pironman5.dtbo \
    overlays/superaudioboard.dtbo \
    overlays/sx150x.dtbo \
    overlays/tc358743-audio.dtbo \
    overlays/tc358743.dtbo \
    overlays/tc358743-pi5.dtbo \
    overlays/tinylcd35.dtbo \
    overlays/tpm-slb9670.dtbo \
    overlays/tpm-slb9673.dtbo \
    overlays/uart0.dtbo \
    overlays/uart0-pi5.dtbo \
    overlays/uart1.dtbo \
    overlays/uart1-pi5.dtbo \
    overlays/uart2.dtbo \
    overlays/uart2-pi5.dtbo \
    overlays/uart3.dtbo \
    overlays/uart3-pi5.dtbo \
    overlays/uart4.dtbo \
    overlays/uart4-pi5.dtbo \
    overlays/uart5.dtbo \
    overlays/udrc.dtbo \
    overlays/ugreen-dabboard.dtbo \
    overlays/upstream.dtbo \
    overlays/upstream-pi4.dtbo \
    overlays/vc4-fkms-v3d.dtbo \
    overlays/vc4-fkms-v3d-pi4.dtbo \
    overlays/vc4-kms-dpi-generic.dtbo \
    overlays/vc4-kms-dpi-hyperpixel2r.dtbo \
    overlays/vc4-kms-dpi-hyperpixel4.dtbo \
    overlays/vc4-kms-dpi-hyperpixel4sq.dtbo \
    overlays/vc4-kms-dpi-panel.dtbo \
    overlays/vc4-kms-dsi-7inch.dtbo \
    overlays/vc4-kms-dsi-generic.dtbo \
    overlays/vc4-kms-dsi-ili9881-5inch.dtbo \
    overlays/vc4-kms-dsi-ili9881-7inch.dtbo \
    overlays/vc4-kms-dsi-lt070me05000.dtbo \
    overlays/vc4-kms-dsi-lt070me05000-v2.dtbo \
    overlays/vc4-kms-dsi-waveshare-800x480.dtbo \
    overlays/vc4-kms-dsi-waveshare-panel.dtbo \
    overlays/vc4-kms-dsi-waveshare-panel-v2.dtbo \
    overlays/vc4-kms-kippah-7inch.dtbo \
    overlays/vc4-kms-v3d.dtbo \
    overlays/vc4-kms-v3d-pi4.dtbo \
    overlays/vc4-kms-v3d-pi5.dtbo \
    overlays/vc4-kms-vga666.dtbo \
    overlays/vga666.dtbo \
    overlays/vl805.dtbo \
    overlays/w1-gpio.dtbo \
    overlays/w1-gpio-pi5.dtbo \
    overlays/w1-gpio-pullup.dtbo \
    overlays/w1-gpio-pullup-pi5.dtbo \
    overlays/w5500.dtbo \
    overlays/watterott-display.dtbo \
    overlays/waveshare-can-fd-hat-mode-a.dtbo \
    overlays/waveshare-can-fd-hat-mode-b.dtbo \
    overlays/wifimac.dtbo \
    overlays/wittypi.dtbo \
    overlays/wm8960-soundcard.dtbo \
    overlays/ws2812-pio.dtbo \
"
